package club.janna.rpcdemo.server.register;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class RPCMapping {
    private static final Map<String, String> SERVICE_MAPPING = new HashMap<>();

    public static void register(String serviceName, String beanName) {
        SERVICE_MAPPING.put(serviceName, beanName);
    }

    public static String getAndDelete(String serviceName) {
        return SERVICE_MAPPING.remove(serviceName);
    }

    public static boolean exists(String serviceName) {
        return SERVICE_MAPPING.containsKey(serviceName);
    }

    public static Set<String> services() {
        return SERVICE_MAPPING.keySet();
    };
}
